﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aliphant.Interfaces
{
    public interface IScriptAgent : IDisposable
    {
        /// <summary>
        /// 初始化环境
        /// </summary>
        void InitHost();

        /// <summary>
        /// 注册对象
        /// </summary>
        /// <param name="object"></param>
        void RegisterObject(dynamic @object);

        /// <summary>
        /// 注册依赖
        /// </summary>
        /// <param name="dlls"></param>
        void RegisterEnv(string[] dlls);

        /// <summary>
        /// 注册工具
        /// </summary>
        /// <param name="objects"></param>
        void RegisterTools(IScriptTool tools);

        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="code">JS代码</param>
        object Evaluate(string code);

        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="path">JS文件</param>
        /// <returns></returns>
        object Execute(string path);
    }
}
